﻿using QuestionnaireInvestigation.Data.Service;
using QuestionnaireInvestigation.DTOS;
using QuestionnaireInvestigation.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace QuestionnaireInvestigation.Controllers
{

    public class AdminController : ApiController
    {
        public string Options()
        {
            return null; // HTTP 200 response with empty body
        }
        AdminService _service = new AdminService();
        [Authorize]
        [System.Web.Mvc.HttpGet]
        public AdminInfoDTO GetAdminInfo()
        {
            string auth = Request.Headers.Authorization.ToString();
            var admin =  ExtensionMethods.GetEmployeeUserObject(auth);
            AdminInfoDTO adminInfo = new AdminInfoDTO
            {
                email = admin.Email,
                NickName = admin.Nickname
            };
            return adminInfo;
        }
  
    }
}
